using UnityEngine;

public class PlayerCharacter : Character {
    // 受伤逻辑
    protected override void Hit(Attack attack)
    {
        GetComponent<PlayerFSM>().parameter.isHurt = true;

        //时停
        TimeManager.Instance.BulletTime(0.1f, 1f);

        //击退
        Vector2 direction = (transform.position - attack.transform.parent.position).normalized;//击退方向
        rb.velocity = backPosition * direction;

        //受击特效
        hitEffects.Play();

        //伤害飘字
        GameManager.Instance.ShowText(attack.damage.ToString(), transform, Color.red);

        //屏幕抖动
        GameManager.Instance.CameraShake(1f);
    }

    // 死亡逻辑
    protected override void Die()
    {
        isDead = true;
        GetComponent<PlayerFSM>().parameter.isDead = true;
        //死亡特效
        dieEffects.Play();
    }
}
